﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<CourseSystem.Core.Entities.ExaminationInfo>" %>

<%@ Import Namespace="Chowpoo.Util" %>
<%@ Import Namespace="CourseSystem.Common.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%=QuestionLibHelper.GetDtType(ViewData["type"].CheckInt(0))%>设置
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% var type = ViewData["type"].CheckInt(0);
       var title = QuestionLibHelper.GetDtType(type) + "设置";
    %>
    <% Html.RenderPartial("AdminTopUc", title); %>
    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table03">
        <tr class="box03">
            <td width="50%">
                <%=Model.Title %>
            </td>
            <td height="28">
                <div>
                    <input type="button" id="addItem" value="添加题目" /><%=Html.ActionButton("返回", "Examination", new { Model.Type,Model.SectionId })%>
                </div>
            </td>
        </tr>
    </table>
    <table width="100%" height="5" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
        <tr>
            <td height="5" bgcolor="#FFFFFF">
            </td>
        </tr>
    </table>
    <div id="listDiv">
        <% Html.RenderAction("ExaminationItemListUc", new { eid = Model.Id, type = type }); %>
    </div>
    <div id="editDiv" title="添加题目">
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    <%var type = ViewData["type"].CheckInt(0);
    %>
    <script type="text/javascript">
        $(function () {
            $("#editDiv").dialog({
                autoOpen: false,
                height: 550,
                width: 850,
                modal: true,
                close: function () {
                    window.location.reload();
                }
                
            });

            $("#addItem")
                .click(function () {
                    $("#editDiv").html("loading...");
                    $("#editDiv").load(appRoot + 'AdminExamLib/LibSelectItemList/?eid=<%=Model.Id %>&type=<%=type %>&rd=' + rdTime());
                    $("#editDiv").dialog("open");
                });


        });

        var selectItem = function (obj, id, eid) {
            var objDom = $(obj);
            $.getJSON(appRoot + 'Ajax/SelectLibItem/' + id + '?eid=' + eid + '&rd=' + rdTime(), function (data) {
                if (data == null || data.error == 1)
                    alert("未知错误.");
                else {
                    var nowText = data.now == 1 ? "取消选择" : "选择";
                    $(objDom).text(nowText);
                }
            });
        };

    </script>
</asp:Content>
